---
id: "int-decorator"
keywords: ["int", "decorator"]
name: "@int"
summary: "This is the `@int` decorator."
category: "decorators"
---

The `@int` decorator can be used with [polymorphic variants](../docs/manual/polymorphic-variant.mdx) and the `@as` decorator on _externals_ to modify the compiled JavaScript to use integers for the values instead of strings.

### Example

<CodeTab labels={["ReScript", "JS Output"]}>

```res
@val external setStatus: @int[
  @as(0) #NotStarted |
  @as(1) #Started |
  @as(2) #Done
] => unit = "setStatus"

setStatus(#Done)
```

```js
setStatus(2);
```

</CodeTab>

### References

- [Constrain Arguments Better](../docs/manual/bind-to-js-function.mdx#constrain-arguments-better)
